package com.ddyx.rest.user;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.user.UBrandService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

@Controller
@RequestMapping("/ubrand")
public class UBrandController {
	
	@Resource
	UBrandService uBrandService;
	
	/**
	 * 获取品牌列表
	 * @author liuhoujie
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/getBrandList")
	public ResponseForm getBrandList() {
		return uBrandService.getBrandList();
	}
	
	/**
	 * 获取品牌分页列表
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getBrandListPage",method=RequestMethod.POST)
	public ResponseForm getBrandListPage(@RequestBody RequestForm param) {
		return uBrandService.getBrandListPage(param);
	}
	
	
	/**
	 * 新增品牌
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/addBrand",method=RequestMethod.POST)
	public ResponseForm addBrand(@RequestBody RequestForm param) {
		
		return uBrandService.addBrand(param);
	}
	
	/**
	 * 修改品牌
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/updateBrand",method=RequestMethod.POST)
	public ResponseForm updateBrand(@RequestBody RequestForm param) {
		
		return uBrandService.updateBrand(param);
	}
	
	/**
	 * 根据ID查询单个品牌
	 * @author wush
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getBrandById",method=RequestMethod.POST)
	public ResponseForm getBrandById(@RequestBody RequestForm param) {
		
		return uBrandService.getBrandById(param);
		
		
	}
	
}
